<template>
    <div>
        <el-row :gutter="15">
			<el-form ref="elForm" :model="dataForm" :rules="rules" size="medium" label-width="150px" label-position="right" :disabled="setting.readonly">
				<el-col :span="12" v-if="JudgeShow('zyzmc')">
					<el-form-item label="作业证名称" prop="zyzmc" >
						<el-input v-model="dataForm.zyzmc"  :disabled ="JudgeWrite('zyzmc')"  placeholder="请输入" clearable :style='{"width":"100%"}' >
							<template slot="prepend"></template>
							<template slot="append"></template>
						</el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('zyzbh')">
					<el-form-item label="作业证编号" prop="zyzbh" >
						<el-input v-model="dataForm.zyzbh"  :disabled ="JudgeWrite('zyzbh')"  placeholder="系统自动生成" readonly >
						</el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('sqdw')">
					<el-form-item label="申请单位" prop="sqdw" >
						<el-select v-model="dataForm.sqdw" @change="person" :disabled ="JudgeWrite('sqdw')"  placeholder="请选择" clearable :style='{"width":"100%"}' >
							<el-option v-for="(item, index) in sqdwOptions" :key="index" :label="item.F_FullName" :value="item.F_Id" ></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('sqr')">
					<el-form-item label="申请人" prop="sqr" >
						<!-- <el-select v-model="dataForm.sqr"  :disabled ="JudgeWrite('sqr')"  placeholder="请选择" clearable :style='{"width":"100%"}' >
							<el-option v-for="(item, index) in sqrOptions" :key="index" :label="item.F_RealName" :value="item.F_Id" ></el-option>
						</el-select> -->
						<el-select v-model="dataForm.sqr" :disabled ="JudgeWrite('sqr')" placeholder="请选择" clearable :style='{"width":"100%"}' filterable>
							<el-option v-for="(item, index) in personAll" :key="index" :label="item.realName" :value="item.id" ></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('sqrq')">
					<el-form-item label="申请日期" prop="sqrq" >
						<el-date-picker v-model="dataForm.sqrq"  :disabled ="JudgeWrite('sqrq')"  placeholder="请选择" clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd" value-format="timestamp" >
						</el-date-picker>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('zykssj')">
					<el-form-item label="作业开始时间" prop="zykssj" >
						<el-date-picker v-model="dataForm.zykssj"  :disabled ="JudgeWrite('zykssj')"  placeholder="请选择" clearable :style='{"width":"100%"}' type="datetime" format="yyyy-MM-dd HH:mm:ss" value-format="timestamp" >
						</el-date-picker>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('zyjssj')">
					<el-form-item label="作业结束时间" prop="zyjssj" >
						<el-date-picker v-model="dataForm.zyjssj"  :disabled ="JudgeWrite('zyjssj')"  placeholder="请选择" clearable :style='{"width":"100%"}' type="datetime" format="yyyy-MM-dd HH:mm:ss" value-format="timestamp" >
						</el-date-picker>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('zydd')">
					<el-form-item label="作业地点" prop="zydd" >
						<el-input v-model="dataForm.zydd"  :disabled ="JudgeWrite('zydd')"  placeholder="请输入" clearable :style='{"width":"100%"}' >
							<template slot="prepend"></template>
							<template slot="append"></template>
						</el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('zynr')">
					<el-form-item label="作业内容" prop="zynr" >
						<el-input v-model="dataForm.zynr"  :disabled ="JudgeWrite('zynr')"  placeholder="请输入" clearable :style='{"width":"100%"}' >
							<template slot="prepend"></template>
							<template slot="append"></template>
						</el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('zygd')">
					<el-form-item label="作业高度" prop="zygd" >
						<el-input v-model="dataForm.zygd"  :disabled ="JudgeWrite('zygd')"  placeholder="请输入" clearable :style='{"width":"100%"}' >
							<template slot="prepend"></template>
							<template slot="append"></template>
						</el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('zylb')">
					<el-form-item label="作业类别" prop="zylb" >
						<el-input v-model="dataForm.zylb"  :disabled ="JudgeWrite('zylb')"  placeholder="请输入" clearable :style='{"width":"100%"}' >
							<template slot="prepend"></template>
							<template slot="append"></template>
						</el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('zydw')">
					<el-form-item label="作业单位" prop="zydw" >
						<el-select v-model="dataForm.zydw"  :disabled ="JudgeWrite('zydw')"  placeholder="请选择" clearable :style='{"width":"100%"}' >
							<el-option v-for="(item, index) in zydwOptions" :key="index" :label="item.F_FullName" :value="item.F_Id" ></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('jdr')">
					<el-form-item label="监督人" prop="jdr" >
						<el-select v-model="dataForm.jdr"  :disabled ="JudgeWrite('jdr')"  placeholder="请选择" clearable :style='{"width":"100%"}' >
							<el-option v-for="(item, index) in jdrOptions" :key="index" :label="item.F_RealName" :value="item.F_Id" ></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('zyr')">
					<el-form-item label="作业人" prop="zyr" >
						<el-select v-model="dataForm.zyr"  :disabled ="JudgeWrite('zyr')"  placeholder="请选择" clearable :style='{"width":"100%"}' >
							<el-option v-for="(item, index) in zyrOptions" :key="index" :label="item.F_RealName" :value="item.F_Id" ></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('qttszy')">
					<el-form-item label="涉及的其他特殊作业" prop="qttszy" >
						<el-input v-model="dataForm.qttszy"  :disabled ="JudgeWrite('qttszy')"  placeholder="请输入" clearable :style='{"width":"100%"}' >
							<template slot="prepend"></template>
							<template slot="append"></template>
						</el-input>
					</el-form-item>
				</el-col>
				<el-col :span="24" v-if="JudgeShow('whbs')">
					<el-form-item label="危害辨识" prop="whbs" >
						<el-input v-model="dataForm.whbs"  :disabled ="JudgeWrite('whbs')"  placeholder="请输入" show-word-limit :style='{"width":"100%"}' type="textarea" :autosize='{"minRows":4,"maxRows":100}' >
						</el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('aqcsqrr')">
					<el-form-item label="安全措施确认人" prop="aqcsqrr" >
						<el-select v-model="dataForm.aqcsqrr"  :disabled ="JudgeWrite('aqcsqrr')"  placeholder="请选择" clearable :style='{"width":"100%"}' >
							<el-option v-for="(item, index) in aqcsqrrOptions" :key="index" :label="item.F_RealName" :value="item.F_Id" ></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('qtaqcsbzr')">
					<el-form-item label="其他安全措施编制人" prop="qtaqcsbzr" >
						<el-select v-model="dataForm.qtaqcsbzr"  :disabled ="JudgeWrite('qtaqcsbzr')"  placeholder="请选择" clearable :style='{"width":"100%"}' >
							<el-option v-for="(item, index) in qtaqcsbzrOptions" :key="index" :label="item.F_RealName" :value="item.F_Id" ></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="24" v-if="JudgeShow('qtaqcs')">
					<el-form-item label="其他安全措施" prop="qtaqcs" >
						<el-input v-model="dataForm.qtaqcs"  :disabled ="JudgeWrite('qtaqcs')"  placeholder="请输入" show-word-limit :style='{"width":"100%"}' type="textarea" :autosize='{"minRows":4,"maxRows":100}' >
						</el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('qtaqcsqrr')">
					<el-form-item label="其他安全措施确认人" prop="qtaqcsqrr" >
						<el-select v-model="dataForm.qtaqcsqrr"  :disabled ="JudgeWrite('qtaqcsqrr')"  placeholder="请选择" clearable :style='{"width":"100%"}' >
							<el-option v-for="(item, index) in qtaqcsqrrOptions" :key="index" :label="item.F_RealName" :value="item.F_Id" ></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('ssaqjyr')">
					<el-form-item label="实施安全教育人" prop="ssaqjyr" >
						<el-select v-model="dataForm.ssaqjyr"  :disabled ="JudgeWrite('ssaqjyr')"  placeholder="请选择" clearable :style='{"width":"100%"}' >
							<el-option v-for="(item, index) in ssaqjyrOptions" :key="index" :label="item.F_RealName" :value="item.F_Id" ></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="24" v-if="JudgeShow('scdwzyfzryj')">
					<el-form-item label="生产单位负责人意见" prop="scdwzyfzryj" >
						<el-input v-model="dataForm.scdwzyfzryj"  :disabled ="JudgeWrite('scdwzyfzryj')"  placeholder="请输入" show-word-limit :style='{"width":"100%"}' type="textarea" :autosize='{"minRows":4,"maxRows":100}' >
						</el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('scdwzyfzrqm')">
					<el-form-item label="生产单位负责人签名" prop="scdwzyfzrqm" >
						<el-select v-model="dataForm.scdwzyfzrqm"  :disabled ="JudgeWrite('scdwzyfzrqm')"  placeholder="请选择" clearable :style='{"width":"100%"}' >
							<el-option v-for="(item, index) in scdwzyfzrqmOptions" :key="index" :label="item.F_RealName" :value="item.F_Id" ></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('scdwzyfzrqmsj')">
					<el-form-item label="签名时间" prop="scdwzyfzrqmsj" >
						<el-date-picker v-model="dataForm.scdwzyfzrqmsj"  :disabled ="JudgeWrite('scdwzyfzrqmsj')"  placeholder="请选择" clearable :style='{"width":"100%"}' type="datetime" format="yyyy-MM-dd HH:mm:ss" value-format="timestamp" >
						</el-date-picker>
					</el-form-item>
				</el-col>
				<el-col :span="24" v-if="JudgeShow('zydwfzryj')">
					<el-form-item label="作业单位负责人意见" prop="zydwfzryj" >
						<el-input v-model="dataForm.zydwfzryj"  :disabled ="JudgeWrite('zydwfzryj')"  placeholder="请输入" show-word-limit :style='{"width":"100%"}' type="textarea" :autosize='{"minRows":4,"maxRows":100}' >
						</el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('zydwfzrqm')">
					<el-form-item label="作业单位负责人签名" prop="zydwfzrqm" >
						<el-select v-model="dataForm.zydwfzrqm"  :disabled ="JudgeWrite('zydwfzrqm')"  placeholder="请选择" clearable :style='{"width":"100%"}' >
							<el-option v-for="(item, index) in zydwfzrqmOptions" :key="index" :label="item.F_RealName" :value="item.F_Id" ></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('zydwfzrqmsj')">
					<el-form-item label="签名时间" prop="zydwfzrqmsj" >
						<el-date-picker v-model="dataForm.zydwfzrqmsj"  :disabled ="JudgeWrite('zydwfzrqmsj')"  placeholder="请选择" clearable :style='{"width":"100%"}' type="datetime" format="yyyy-MM-dd HH:mm:ss" value-format="timestamp" >
						</el-date-picker>
					</el-form-item>
				</el-col>
				<el-col :span="24" v-if="JudgeShow('shbmyj')">
					<el-form-item label="审核部门意见" prop="shbmyj" >
						<el-input v-model="dataForm.shbmyj"  :disabled ="JudgeWrite('shbmyj')"  placeholder="请输入" show-word-limit :style='{"width":"100%"}' type="textarea" :autosize='{"minRows":4,"maxRows":100}' >
						</el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('shbmqm')">
					<el-form-item label="审核部门签名" prop="shbmqm" >
						<el-select v-model="dataForm.shbmqm"  :disabled ="JudgeWrite('shbmqm')"  placeholder="请选择" clearable :style='{"width":"100%"}' >
							<el-option v-for="(item, index) in shbmqmOptions" :key="index" :label="item.F_RealName" :value="item.F_Id" ></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('shsj')">
					<el-form-item label="审核时间" prop="shsj" >
						<el-date-picker v-model="dataForm.shsj"  :disabled ="JudgeWrite('shsj')"  placeholder="请选择" clearable :style='{"width":"100%"}' type="datetime" format="yyyy-MM-dd HH:mm:ss" value-format="timestamp" >
						</el-date-picker>
					</el-form-item>
				</el-col>
				<el-col :span="24" v-if="JudgeShow('spbmyj')">
					<el-form-item label="审批部门意见" prop="spbmyj" >
						<el-input v-model="dataForm.spbmyj"  :disabled ="JudgeWrite('spbmyj')"  placeholder="请输入" show-word-limit :style='{"width":"100%"}' type="textarea" :autosize='{"minRows":4,"maxRows":100}' >
						</el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('spbmqm')">
					<el-form-item label="审批部门签名" prop="spbmqm" >
						<el-select v-model="dataForm.spbmqm"  :disabled ="JudgeWrite('spbmqm')"  placeholder="请选择" clearable :style='{"width":"100%"}' >
							<el-option v-for="(item, index) in spbmqmOptions" :key="index" :label="item.F_RealName" :value="item.F_Id" ></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('spsj')">
					<el-form-item label="审批时间" prop="spsj" >
						<el-date-picker v-model="dataForm.spsj"  :disabled ="JudgeWrite('spsj')"  placeholder="请选择" clearable :style='{"width":"100%"}' type="datetime" format="yyyy-MM-dd HH:mm:ss" value-format="timestamp" >
						</el-date-picker>
					</el-form-item>
				</el-col>
				<el-col :span="24" v-if="JudgeShow('wgysyj')">
					<el-form-item label="完工验收意见" prop="wgysyj" >
						<el-input v-model="dataForm.wgysyj"  :disabled ="JudgeWrite('wgysyj')"  placeholder="请输入" show-word-limit :style='{"width":"100%"}' type="textarea" :autosize='{"minRows":4,"maxRows":100}' >
						</el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('wgysqm')">
					<el-form-item label="完工验收签名" prop="wgysqm" >
						<el-select v-model="dataForm.wgysqm"  :disabled ="JudgeWrite('wgysqm')"  placeholder="请选择" clearable :style='{"width":"100%"}' >
							<el-option v-for="(item, index) in wgysqmOptions" :key="index" :label="item.F_RealName" :value="item.F_Id" ></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="JudgeShow('wgyssj')">
					<el-form-item label="完工验收时间" prop="wgyssj" >
						<el-date-picker v-model="dataForm.wgyssj"  :disabled ="JudgeWrite('wgyssj')"  placeholder="请选择" clearable :style='{"width":"100%"}' type="datetime" format="yyyy-MM-dd HH:mm:ss" value-format="timestamp" >
						</el-date-picker>
					</el-form-item>
				</el-col>
			</el-form>

        </el-row>
        <UserBox v-if="userBoxVisible" ref="userBox" @submit="submit" />
    </div>
</template>
<script>
    import request from '@/utils/request'
    import { previewDataInterface } from '@/api/systemData/dataInterface'
    import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
    import {departmentPerson}from '@/api/systemIntegration/recard'

    export default {
        components: {},
        props: [],
        data() {
            return {
							  personAll:[], // 申请人
                visible: false,
                setting: {},
                eventType: '',
                userBoxVisible: false,
                dataForm: {
                    id:'',                    
					flowId: '',
					actionType:1,
					freeApproverUserId: '',
					zyzmc:undefined,
					sqdw:undefined,
					sqr:undefined,
					zyzbh:undefined,
					zykssj:undefined,
					zyjssj:undefined,
					zydd:undefined,
					zynr:undefined,
					zygd:undefined,
					zylb:undefined,
					zydw:undefined,
					jdr:undefined,
					zyr:undefined,
					qttszy:undefined,
					whbs:undefined,
					aqcsqrr:undefined,
					qtaqcsbzr:undefined,
					qtaqcs:undefined,
					qtaqcsqrr:undefined,
					ssaqjyr:undefined,
					scdwzyfzryj:undefined,
					scdwzyfzrqm:undefined,
					scdwzyfzrqmsj:undefined,
					zydwfzryj:undefined,
					zydwfzrqm:undefined,
					zydwfzrqmsj:undefined,
					shbmyj:undefined,
					shbmqm:undefined,
					shsj:undefined,
					spbmyj:undefined,
					spbmqm:undefined,
					spsj:undefined,
					wgysyj:undefined,
					wgysqm:undefined,
					wgyssj:undefined,
					sqrq:undefined,

                },
                rules: {

                },
				sqdwOptions:[],
				sqrOptions:[],
				zydwOptions:[],
				jdrOptions:[],
				zyrOptions:[],
				aqcsqrrOptions:[],
				qtaqcsbzrOptions:[],
				qtaqcsqrrOptions:[],
				ssaqjyrOptions:[],
				scdwzyfzrqmOptions:[],
				zydwfzrqmOptions:[],
				shbmqmOptions:[],
				spbmqmOptions:[],
				wgysqmOptions:[],
				wgyssjOptions:[],


            }
        },
        computed: {},
        watch: {},
        created() {
		this.getsqdwOptions();
		this.getsqrOptions();
		this.getzydwOptions();
		this.getjdrOptions();
		this.getzyrOptions();
		this.getaqcsqrrOptions();
		this.getqtaqcsbzrOptions();
		this.getqtaqcsqrrOptions();
		this.getssaqjyrOptions();
		this.getscdwzyfzrqmOptions();
		this.getzydwfzrqmOptions();
		this.getshbmqmOptions();
		this.getspbmqmOptions();
		this.getwgysqmOptions();
		this.getwgyssjOptions();

        },
        mounted() {
					this.gcaqzyz()
				 },
        methods: {
		getsqdwOptions()
		{
			previewDataInterface('772d2cbcadd24df79243e3d92ef5f690').then(res => {
				this.sqdwOptions = res.data
			})
		},
		getsqrOptions()
		{
			previewDataInterface('8bca424f16d6448ab09e57a028853aa9').then(res => {
				this.sqrOptions = res.data
			})
		},
		getzydwOptions()
		{
			previewDataInterface('772d2cbcadd24df79243e3d92ef5f690').then(res => {
				this.zydwOptions = res.data
			})
		},
		getjdrOptions()
		{
			previewDataInterface('8bca424f16d6448ab09e57a028853aa9').then(res => {
				this.jdrOptions = res.data
			})
		},
		getzyrOptions()
		{
			previewDataInterface('8bca424f16d6448ab09e57a028853aa9').then(res => {
				this.zyrOptions = res.data
			})
		},
		getaqcsqrrOptions()
		{
			previewDataInterface('8bca424f16d6448ab09e57a028853aa9').then(res => {
				this.aqcsqrrOptions = res.data
			})
		},
		getqtaqcsbzrOptions()
		{
			previewDataInterface('8bca424f16d6448ab09e57a028853aa9').then(res => {
				this.qtaqcsbzrOptions = res.data
			})
		},
		getqtaqcsqrrOptions()
		{
			previewDataInterface('8bca424f16d6448ab09e57a028853aa9').then(res => {
				this.qtaqcsqrrOptions = res.data
			})
		},
		getssaqjyrOptions()
		{
			previewDataInterface('8bca424f16d6448ab09e57a028853aa9').then(res => {
				this.ssaqjyrOptions = res.data
			})
		},
		getscdwzyfzrqmOptions()
		{
			previewDataInterface('8bca424f16d6448ab09e57a028853aa9').then(res => {
				this.scdwzyfzrqmOptions = res.data
			})
		},
		getzydwfzrqmOptions()
		{
			previewDataInterface('8bca424f16d6448ab09e57a028853aa9').then(res => {
				this.zydwfzrqmOptions = res.data
			})
		},
		getshbmqmOptions()
		{
			previewDataInterface('8bca424f16d6448ab09e57a028853aa9').then(res => {
				this.shbmqmOptions = res.data
			})
		},
		getspbmqmOptions()
		{
			previewDataInterface('8bca424f16d6448ab09e57a028853aa9').then(res => {
				this.spbmqmOptions = res.data
			})
		},
		getwgysqmOptions()
		{
			previewDataInterface('8bca424f16d6448ab09e57a028853aa9').then(res => {
				this.wgysqmOptions = res.data
			})
		},
		getwgyssjOptions()
		{
			previewDataInterface('8bca424f16d6448ab09e57a028853aa9').then(res => {
				this.wgyssjOptions = res.data
			})
		},

            goBack() {
                this.$emit('refresh')
            },
						// 申请人
						async person(id) {
							this.dataForm.sqr = ''
							const {data} = await departmentPerson({organizeId:id})
							this.personAll = data.list
						},
						// 申请单位
						fullName(val,id) {
							this.person(id)
							this.val = val
							this.dataForm.sqdw = val
						},
						// 数据回填申请单位
						gcaqzyz() {
              let fullName = this.$store.getters.itemData.fullName   
							// 申请单位
							switch (fullName) {
                case '禄口油库高处安全作业证':
                  return this.fullName('禄口油库','0e7420aab60f4d1d9297be06258760e9')
								break;
								case '航空加油站高处安全作业证':
									return this.fullName('航空加油站','aa579f18def44c298497c7a9727fcf76')
								break;
								case '管道中心高处安全作业证':
									return this.fullName('管道中心','0f3b5731aa2f4542a0b143e858c59b66')
								break;
								case '机坪车辆加油站高处安全作业证':
									return this.fullName('机坪车辆加油站','3094a0f6f74d470e9b95dcc406bfcb0f')
								break;
							}
						},
            init(data) {

                this.loading = true
                this.dataForm.id = data.id || ''
                this.setting = data
                this.visible = true;
                this.$nextTick(() => {
                    this.$refs['elForm'].resetFields();
                    if (this.dataForm.id) {
                        request({
                            url: '/api/WorkFlowForm/qyaqscGcaqzyz/' + this.dataForm.id,
                            method: 'get'
                        }).then(res => {
														this.dataForm.sqdw = this.val
                            this.dataForm = res.data

                        })
                    } else {
											this.dataForm.flowId = data.flowId
											this.dataForm.sqdw = this.val
                    }
                    this.loading = false
                })
            },
            // 表单提交
            dataFormSubmit(eventType) {            

                this.$refs['elForm'].validate((valid) => {
                    if (valid) {
                        if (eventType === 'audit' || eventType === 'reject') {
                            this.$emit('approval', this.dataForm, eventType)
                            return
                         }
                        this.dataForm.actionType = eventType === 'submit' ? 0 : 1
                        this.eventType = eventType
                        if (this.eventType === 'submit') {
                            if (this.setting.freeApprover == 0) {
                                this.$confirm('您确定要提交当前流程吗, 是否继续?', '提示', {
                                    type: 'warning'
                                }).then(() => {
                                    this.submit()
                                }).catch(() => { });
                            } else {
                                this.userBoxVisible = true
                                this.$nextTick(() => {
                                    this.$refs.userBox.init()
                                })
                            }
                        } else {
                            this.request()
                        }
                    }
                })
            },
            submit(freeApproverUserId) {
                if (freeApproverUserId) this.dataForm.freeApproverUserId = freeApproverUserId
                this.request()
            },
            request() {
                if (!this.dataForm.id) {
                    delete (this.dataForm.id)
                    request({
                        url: '/api/WorkFlowForm/qyaqscGcaqzyz',
                        method: 'post',
                        data: this.dataForm
                    }).then((res) => {
                        this.$message({
                            message: res.msg,
                            type: 'success',
                            duration: 1000,
                            onClose: () => {
                                this.visible = false
                                this.$emit('close', true)
                            }
                        })
                    })
                } else {
                    request({
                        url: '/api/WorkFlowForm/qyaqscGcaqzyz/' + this.dataForm.id,
                        method: 'PUT',
                        data: this.dataForm
                    }).then((res) => {
                        this.$message({
                            message: res.msg,
                            type: 'success',
                            duration: 1000,
                            onClose: () => {
                                this.visible = false
                                this.$emit('close', true)
                            }
                        })
                    })
                }
            },
            JudgeShow(id) {
                if (!this.setting.formOperates || !this.setting.formOperates.length) return true
                let arr = this.setting.formOperates.filter(o => o.id === id) || []
                if (!arr.length) return true
                let item = arr[0]
                return item.read
            },
            JudgeWrite(id) {
                if (!this.setting.formOperates || !this.setting.formOperates.length) return false
                let arr = this.setting.formOperates.filter(o => o.id === id) || []
                if (!arr.length) return true
                let item = arr[0]
                return !item.write
            },

        },
    }

</script>
